package com.sduept.nwld.dataserver.manager.etl;

import com.sduept.core.dao.SuperDAO;
import com.sduept.bigdata.fault.common.ETLDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CimFaultETLManager {
	@Autowired
	private SuperDAO dao;
	
	@Autowired
	private ETLDAO eDao;
	
	public  void receiveAndSaveAllData() {
		List<?> list = getAllSourceData();
		receiveAndSave(list);
	}
	public  void receiveAndSavePartData(String date) {
		List<?> list = getAllSourceData(date);
		receiveAndSave(list);
	}
	
	
	public List<?> getAllSourceData(){
		List <?>result = eDao.query("select subControlArea,faultTime,faultEquiment,lightningGPS,linePatrolReasult from t_daily_befback ");
		return result;
	}
	public List<?> getAllSourceData(String date) {
		String sql = "select subControlArea,faultTime,faultEquiment,lightningGPS,linePatrolReasult from t_daily_befback"
				+ " where update_time=";
		List<?> result = eDao.query(sql + "'" + date + "'");
		return result;
	}
	public  void receiveAndSave(List<?> list) {
		ETLDataSave equipmentSave = new ETLDataSave(list);
		equipmentSave.saveToBean();
	}
	public class ETLDataSave{
		private List<?> list;
 
		public ETLDataSave(List<?> list) {
			super();
			this.list = list;
		}
		public void saveToBean(){
			
		}
	}
}
